package seedmarket

/**
 * Represents a domain class for the User. Includes specifics about a User such as name, birth date and address.
 * It also orders the information and validates.
 * @author Gregory Koutrelakos
 * @version 7.11.12
 *
 */
class User {
	String userName
	String password
	String fullName
	String gender
	Date birthDate
	String address
	String city
	String state
	String zipcode
	String email
	
	/**
	 * When called, it will display the full name of the User.
	 */
	String toString() {
		"${fullName}"
	}
	
	//used to link together this class to the Seed class. 
	//hasMany means that there are many seeds per user
	static hasMany = [seeds: Seed]

	/**
	 * Orders the information of the User page as well as it validates.
	 */
    static constraints = {
		fullName(blank: false)
		gender(inList: ["Male", "Female"])
		birthDate(blank: false)
		address(blank: false)
		city(blank: false)
		state(blank: false)
		zipcode(blank: false)
		email(email: true)
		userName(blank: false, unique: true)
		password(blank: false, password: true)
    }
}
